﻿Public Class frmShadowAccessSelection

    Public Value As Arps.Engine.ShadowAccessRights

    Private Sub frmShadowAccessSelection_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Value = 0
        chkAppend_CheckedChanged(sender, e)
    End Sub

    Private Sub cmdSet_Click(sender As Object, e As EventArgs) Handles cmdSet.Click
        Value = 0
        If chkAppend.Checked Then
            Value = Value Or Arps.Engine.ShadowAccessRights.Append
        End If
        If chkDelete.Checked Then
            Value = Value Or Arps.Engine.ShadowAccessRights.Delete
        End If
        If chkOverride.Checked Then
            Value = Value Or Arps.Engine.ShadowAccessRights.Overwrite
        End If

        Me.Close()
    End Sub

    Private Sub chkOverride_CheckedChanged(sender As Object, e As EventArgs) Handles chkOverride.CheckedChanged
        Dim v As Arps.Engine.ShadowAccessRights
        v = Arps.Engine.ShadowAccessRights.None

        If chkAppend.Checked Then v = v Or Arps.Engine.ShadowAccessRights.Append
        If chkDelete.Checked Then v = v Or Arps.Engine.ShadowAccessRights.Delete
        If chkOverride.Checked Then v = v Or Arps.Engine.ShadowAccessRights.Overwrite

        lblEffectiveAccess.Text = v.ToString()
    End Sub

    Private Sub chkDelete_CheckedChanged(sender As Object, e As EventArgs) Handles chkDelete.CheckedChanged
        Dim v As Arps.Engine.ShadowAccessRights
        v = Arps.Engine.ShadowAccessRights.None

        If chkAppend.Checked Then v = v Or Arps.Engine.ShadowAccessRights.Append
        If chkDelete.Checked Then v = v Or Arps.Engine.ShadowAccessRights.Delete
        If chkOverride.Checked Then v = v Or Arps.Engine.ShadowAccessRights.Overwrite

        lblEffectiveAccess.Text = v.ToString()
    End Sub

    Private Sub chkAppend_CheckedChanged(sender As Object, e As EventArgs) Handles chkAppend.CheckedChanged
        Dim v As Arps.Engine.ShadowAccessRights
        v = Arps.Engine.ShadowAccessRights.None

        If chkAppend.Checked Then v = v Or Arps.Engine.ShadowAccessRights.Append
        If chkDelete.Checked Then v = v Or Arps.Engine.ShadowAccessRights.Delete
        If chkOverride.Checked Then v = v Or Arps.Engine.ShadowAccessRights.Overwrite

        lblEffectiveAccess.Text = v.ToString()
    End Sub
End Class